<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间转换</title>
</head>
<body>
    <script>
        function fn(totalsecond){
            totalsecond = 
            isNaN(totalsecond)?0 : 
            parseInt(totalsecond);
            let h = parseInt(totalsecond /60 /60%24);
            let m = parseInt(totalsecond /60 %60);
            let s = parseInt (totalsecond % 60)

            function addzero(num){
                return num < 10 ? "0" + num : num ;
            }
            h = addzero (h);
            m = addzero (m);
            s = addzero (s);
            return h + "时" + m + "分" + s + "秒"
        }
        let inputsecond = +prompt('请用户输入秒数')
        let result =  fn(inputsecond)
        document.write(result);
        
    </script>
</body>
</html>